namespace DotNetNuke.Entities.Modules
{
    using DotNetNuke.Entities.Portals;
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Runtime.CompilerServices;

    public class ModuleSettingsBase : PortalModuleBase
    {
        private int _moduleId;
        private Hashtable _moduleSettings;
        private Hashtable _settings;
        private int _tabModuleId;
        private Hashtable _tabModuleSettings;

        public virtual void LoadSettings()
        {
        }

        public virtual void UpdateSettings()
        {
        }

        public int ModuleId
        {
            get
            {
                return this._moduleId;
            }
            set
            {
                this._moduleId = value;
            }
        }

        public Hashtable ModuleSettings
        {
            get
            {
                if (this._moduleSettings == null)
                {
                    this._moduleSettings = PortalSettings.GetModuleSettings(this.ModuleId);
                }
                return this._moduleSettings;
            }
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Hashtable Settings
        {
            get
            {
                if (this._settings == null)
                {
                    this._settings = new Hashtable(this.ModuleSettings);
                    IDictionaryEnumerator refObjectHelperL0 = this.TabModuleSettings.GetEnumerator();
                    while (refObjectHelperL0.MoveNext())
                    {
                        DictionaryEntry di = (DictionaryEntry) refObjectHelperL0.Current;
                        this._settings.Add(RuntimeHelpers.GetObjectValue(di.Key), RuntimeHelpers.GetObjectValue(di.Value));
                    }
                }
                return this._settings;
            }
        }

        public int TabModuleId
        {
            get
            {
                return this._tabModuleId;
            }
            set
            {
                this._tabModuleId = value;
            }
        }

        public Hashtable TabModuleSettings
        {
            get
            {
                if (this._tabModuleSettings == null)
                {
                    this._tabModuleSettings = PortalSettings.GetTabModuleSettings(this.TabModuleId);
                }
                return this._tabModuleSettings;
            }
        }
    }
}

